package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TNumberPersistenceInfoMapper;
import com.ruoyi.system.domain.TNumberPersistenceInfo;
import com.ruoyi.system.service.ITNumberPersistenceInfoService;

/**
 * 运单编号Service业务层处理
 * 
 * @author wzy
 * @date 2024-08-30 16:42:11
 */
@Service
public class TNumberPersistenceInfoServiceImpl implements ITNumberPersistenceInfoService 
{
    @Autowired
    private TNumberPersistenceInfoMapper tNumberPersistenceInfoMapper;

    /**
     * 查询运单编号
     * 
     * @param numberPersistenceId 运单编号主键
     * @return 运单编号
     */
    @Override
    public TNumberPersistenceInfo selectTNumberPersistenceInfoByNumberPersistenceId(Long numberPersistenceId)
    {
        return tNumberPersistenceInfoMapper.selectTNumberPersistenceInfoByNumberPersistenceId(numberPersistenceId);
    }

    /**
     * 查询运单编号列表
     * 
     * @param tNumberPersistenceInfo 运单编号
     * @return 运单编号
     */
    @Override
    public List<TNumberPersistenceInfo> selectTNumberPersistenceInfoList(TNumberPersistenceInfo tNumberPersistenceInfo)
    {
        return tNumberPersistenceInfoMapper.selectTNumberPersistenceInfoList(tNumberPersistenceInfo);
    }

    /**
     * 新增运单编号
     * 
     * @param tNumberPersistenceInfo 运单编号
     * @return 结果
     */
    @Override
    public int insertTNumberPersistenceInfo(TNumberPersistenceInfo tNumberPersistenceInfo)
    {
        tNumberPersistenceInfo.setCreateTime(DateUtils.getNowDate());
        return tNumberPersistenceInfoMapper.insertTNumberPersistenceInfo(tNumberPersistenceInfo);
    }

    /**
     * 修改运单编号
     * 
     * @param tNumberPersistenceInfo 运单编号
     * @return 结果
     */
    @Override
    public int updateTNumberPersistenceInfo(TNumberPersistenceInfo tNumberPersistenceInfo)
    {
        tNumberPersistenceInfo.setUpdateTime(DateUtils.getNowDate());
        return tNumberPersistenceInfoMapper.updateTNumberPersistenceInfo(tNumberPersistenceInfo);
    }

    /**
     * 批量删除运单编号
     * 
     * @param numberPersistenceIds 需要删除的运单编号主键
     * @return 结果
     */
    @Override
    public int deleteTNumberPersistenceInfoByNumberPersistenceIds(Long[] numberPersistenceIds)
    {
        return tNumberPersistenceInfoMapper.deleteTNumberPersistenceInfoByNumberPersistenceIds(numberPersistenceIds);
    }

    /**
     * 删除运单编号信息
     * 
     * @param numberPersistenceId 运单编号主键
     * @return 结果
     */
    @Override
    public int deleteTNumberPersistenceInfoByNumberPersistenceId(Long numberPersistenceId)
    {
        return tNumberPersistenceInfoMapper.deleteTNumberPersistenceInfoByNumberPersistenceId(numberPersistenceId);
    }

    /**
     * 取一个运单编号
     *
     * @param numberPersistenceId 运单编号主键
     * @return 运单编号
     */
    @Override
    public TNumberPersistenceInfo getOne(Long numberPersistenceId)
    {
        //Long numberPersistenceId = 1L;
        TNumberPersistenceInfo tNumberPersistenceInfo;
        tNumberPersistenceInfo = tNumberPersistenceInfoMapper.selectTNumberPersistenceInfoByNumberPersistenceId(numberPersistenceId);
        tNumberPersistenceInfo.addOne();
        tNumberPersistenceInfoMapper.updateTNumberPersistenceInfo(tNumberPersistenceInfo);
        return tNumberPersistenceInfo;
    }
}
